home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / dejagnu.lha / dejagnu-1.0.1 / dejagnu / test-tool < prev    next >
Text File  |  1993-03-02  |  3KB  |  141 lines

  1. #!/bin/sh
  2. # This script automatically test the given tool with the tool's test cases,
  3. # reporting anything of interest.
  4.  
  5. # exits with 1 if there is nothing of interest
  6. # exits with 0 if there is something interesting
  7. # exits with 2 if an error occurred
  8.  
  9. # Limitations, don't run this multiple times in one day, unless the -noupdate
  10. # flag is given.
  11.  
  12. # Written by Mike Stump <mrs@cygnus.com>
  13.  
  14. if [ $# = 2 ]; then
  15.     if [ "$1" = -noupdate ]; then
  16.         update=no
  17.         shift
  18.     fi
  19. fi
  20.  
  21. if [ $# != 1 ]; then
  22.     echo "Usage: [-noupdate] tool_name" >&2
  23.     exit 2
  24. fi
  25.  
  26. tool=$1
  27.  
  28. if [ -d "$HOME/devo/." ]; then
  29.     DEVO=$HOME/devo
  30. fi
  31.  
  32. cd $HOME/devo/deja-gnu || exit 2
  33.  
  34. tmp=/tmp/$tool-testing.$$a
  35. tmp1=/tmp/$tool-testing.$$b
  36. tmp2=/tmp/$tool-testing.$$c
  37.  
  38. ./runtest -tool $tool -v -v -v -v -a -a >/dev/null 2>/dev/null
  39.  
  40. if [ "$update" = no ]; then
  41.     now=$tool.sum
  42.     before=`ls $tool.sum-* | tail -1`
  43. else
  44.     mv $tool.sum $tool.sum-`date '+%y%m%d'`
  45.     mv detail/$tool.log detail/$tool.log-`date '+%y%m%d'`
  46.  
  47.     now=`ls $tool.sum-* | tail -1`
  48.     before=`ls $tool.sum-* | tail -2 | sed 1q`
  49. fi
  50. trap "rm -f $tmp $tmp1 $tmp2" 0 1 2 3 5 9 13 15
  51.  
  52. if [ "$before" = "" ]; then
  53.     echo "Need previous summary to compare against." >&2
  54.     exit 2
  55. fi
  56.  
  57. grep '^FAIL' "$now" | sed 's/^....:    //' >$tmp1
  58. grep '^PASS' "$before" | sed 's/^....:    //' | comm $tmp1 -12 - >$tmp2
  59.  
  60. grep -s . $tmp2
  61. if [ $? = 0 ]; then
  62.     echo "Tests that now fail, but worked before:"
  63.     echo
  64.     cat $tmp2
  65.     showchangelog=1
  66.     echo
  67. fi
  68.  
  69. grep '^PASS' "$now" | sed 's/^....:    //' >$tmp1
  70. grep '^FAIL' "$before" | sed 's/^....:    //' | comm $tmp1 -12 - >$tmp2
  71.  
  72. grep -s . $tmp2
  73. if [ $? = 0 ]; then
  74.     echo "Tests that now work, but didn't before:"
  75.     echo
  76.     cat $tmp2
  77.     echo
  78. fi
  79.  
  80. grep '^FAIL' "$now" | sed 's/^....:    //' >$tmp1
  81. grep '^[PF]A[SI][SL]' "$before" | sed 's/^....:    //' | comm $tmp1 -23 - >$tmp2
  82.  
  83. grep -s . $tmp2
  84. if [ $? = 0 ]; then
  85.     echo "New tests that FAIL:"
  86.     echo
  87.     cat $tmp2
  88.     echo
  89. fi
  90.  
  91. grep '^PASS' "$now" | sed 's/^....:    //' >$tmp1
  92. grep '^[PF]A[SI][SL]' "$before" | sed 's/^....:    //' | comm $tmp1 -23 - >$tmp2
  93.  
  94. grep -s . $tmp2
  95. if [ $? = 0 ]; then
  96.     echo "New tests that PASS:"
  97.     echo
  98.     cat $tmp2
  99.     echo
  100. fi
  101.  
  102. grep '^[PF]A[SI][SL]' "$now" | sed 's/^....:    //' >$tmp1
  103. grep '^[PF]A[SI][SL]' "$before" | sed 's/^....:    //' | comm $tmp1 -13 - >$tmp2
  104.  
  105. grep -s . $tmp2
  106. if [ $? = 0 ]; then
  107.     echo "Tests that have disappeared: (Eeek!)"
  108.     echo
  109.     cat $tmp2
  110.     echo
  111. fi
  112.  
  113.  
  114. if [ "$tool" = g++ ]; then
  115.     devoname=gcc
  116. elif [ "$tool" = gcc ]; then
  117.     devoname=gcc
  118. elif [ "$tool" = gdb ]; then
  119.     devoname=gdb
  120. fi
  121. if [ "$devoname" != "" ]; then
  122.     if [ "$showchangelog" = 1 ]; then
  123.         echo "Here is what's new in the ChangeLog:"
  124.         echo
  125.         diff -c detail/$devoname.ChangeLog $DEVO/$devoname/ChangeLog
  126.         echo
  127.     fi
  128.     if [ "$update" != no ]; then
  129.         # save the old ChangeLog as a reference for nest time
  130.         cp -p $DEVO/$devoname/ChangeLog detail/$devoname.ChangeLog
  131.     fi
  132. fi
  133.  
  134. diff $before $now | grep -s .
  135. if [ $? = 0 ]; then
  136.     echo "Details:"
  137.     echo
  138.     diff $before $now
  139.     echo
  140. fi
  141.